

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>federatedml.feature.binning package &mdash; FATE 1.0 documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script type="text/javascript" src="_static/jquery.js"></script>
        <script type="text/javascript" src="_static/underscore.js"></script>
        <script type="text/javascript" src="_static/doctools.js"></script>
        <script type="text/javascript" src="_static/language_data.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> FATE
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <!-- Local TOC -->
              <div class="local-toc"><ul>
<li><a class="reference internal" href="#">federatedml.feature.binning package</a><ul>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-federatedml.feature.binning.base_binning">federatedml.feature.binning.base_binning module</a></li>
<li><a class="reference internal" href="#module-federatedml.feature.binning.bucket_binning">federatedml.feature.binning.bucket_binning module</a></li>
<li><a class="reference internal" href="#module-federatedml.feature.binning.quantile_binning">federatedml.feature.binning.quantile_binning module</a></li>
<li><a class="reference internal" href="#module-federatedml.feature.binning">Module contents</a></li>
</ul>
</li>
</ul>
</div>
            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">FATE</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
      <li>federatedml.feature.binning package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/federatedml.feature.binning.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="federatedml-feature-binning-package">
<h1>federatedml.feature.binning package<a class="headerlink" href="#federatedml-feature-binning-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-federatedml.feature.binning.base_binning">
<span id="federatedml-feature-binning-base-binning-module"></span><h2>federatedml.feature.binning.base_binning module<a class="headerlink" href="#module-federatedml.feature.binning.base_binning" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="federatedml.feature.binning.base_binning.Binning">
<em class="property">class </em><code class="descclassname">federatedml.feature.binning.base_binning.</code><code class="descname">Binning</code><span class="sig-paren">(</span><em>params</em>, <em>party_name</em>, <em>abnormal_list=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This is use for discrete data so that can transform data or use information for feature selection.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>params</strong> (<em>FeatureBinningParam object</em><em>,</em>) – Parameters that user set.</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="federatedml.feature.binning.base_binning.Binning.cols_dict">
<code class="descname">cols_dict</code><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.cols_dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Record key, value pairs where key is cols’ name, and value is cols’ index. This is use for obtain correct
data from a data_instance</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">dict</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="staticmethod">
<dt id="federatedml.feature.binning.base_binning.Binning.add_label_in_partition">
<em class="property">static </em><code class="descname">add_label_in_partition</code><span class="sig-paren">(</span><em>data_bin_with_table</em>, <em>total_bin</em>, <em>cols_dict</em>, <em>encryptor=None</em>, <em>header=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.add_label_in_partition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.add_label_in_partition" title="Permalink to this definition">¶</a></dt>
<dd><p>Add all label, so that become convenient to calculate woe and iv</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>data_bin_with_table</strong> (<em>DTable</em>) – The input data, the DTable is like:
(id, {‘x1’: 1, ‘x2’: 5, ‘x3’: 2}, y, 1 - y)</li>
<li><strong>total_bin</strong> (<em>int</em><em>, </em><em>&gt; 0</em>) – Specify the largest bin number</li>
<li><strong>cols_dict</strong> (<em>dict</em>) – Record key, value pairs where key is cols’ name, and value is cols’ index.</li>
<li><strong>encryptor</strong> (<em>Paillier Object</em>) – If encryptor is not None, y and 1-y is indicated to be encrypted and will initialize 0 with encryption.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><p><strong>result_sum</strong> –</p>
<dl class="docutils">
<dt>{‘x1’: [[event_count, non_event_count], [event_count, non_event_count] … ],</dt>
<dd><p class="first last">’x2’: [[event_count, non_event_count], [event_count, non_event_count] … ],
…</p>
</dd>
</dl>
<p>}</p>
</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">the result DTable. It is like:</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="staticmethod">
<dt id="federatedml.feature.binning.base_binning.Binning.aggregate_partition_label">
<em class="property">static </em><code class="descname">aggregate_partition_label</code><span class="sig-paren">(</span><em>sum1</em>, <em>sum2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.aggregate_partition_label"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.aggregate_partition_label" title="Permalink to this definition">¶</a></dt>
<dd><p>Used in reduce function. Aggregate the result calculate from each partition.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>sum1</strong> (<em>DTable.</em>) – <dl class="docutils">
<dt>It is like:</dt>
<dd><dl class="first docutils">
<dt>{‘x1’: [[event_count, non_event_count], [event_count, non_event_count] … ],</dt>
<dd>’x2’: [[event_count, non_event_count], [event_count, non_event_count] … ],
…</dd>
</dl>
<p class="last">}</p>
</dd>
</dl>
</li>
<li><strong>sum2</strong> (<em>DTable</em>) – Same as sum1</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Merged sum. The format is same as sum1.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="staticmethod">
<dt id="federatedml.feature.binning.base_binning.Binning.bin_data">
<em class="property">static </em><code class="descname">bin_data</code><span class="sig-paren">(</span><em>instance</em>, <em>split_points</em>, <em>cols_dict</em>, <em>header</em>, <em>is_sparse</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.bin_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.bin_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply the binning method</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>instance</strong> (<em>DTable</em>) – The input data</li>
<li><strong>split_points</strong> (<em>dict.</em>) – <p>Each value represent for the split points for a feature. The element in each row represent for
the corresponding split point.
e.g.
split_points = {‘x1’: [0.1, 0.2, 0.3, 0.4 …],    # The first feature</p>
<blockquote>
<div>’x2’: [1, 2, 3, 4, …],           # The second feature
…]                         # Other features</div></blockquote>
</li>
<li><strong>cols_dict</strong> (<em>dict</em>) – Record key, value pairs where key is cols’ name, and value is cols’ index.</li>
<li><strong>is_sparse</strong> (<em>bool</em>) – Specify whether it is sparse data or not</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><p><strong>result_bin_dict</strong> – Each element represent for the corresponding bin number this feature belongs to.
e.g. it could be:
[{1: 1, 2: 5, 3: 2}
…</p>
<blockquote>
<div><p>]  # Each number represent for the bin number it belongs to.</p>
</div></blockquote>
</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">dict.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="staticmethod">
<dt id="federatedml.feature.binning.base_binning.Binning.cal_iv_woe">
<em class="property">static </em><code class="descname">cal_iv_woe</code><span class="sig-paren">(</span><em>result_counts</em>, <em>adjustment_factor</em>, <em>split_points=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.cal_iv_woe"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.cal_iv_woe" title="Permalink to this definition">¶</a></dt>
<dd><p>Given event count information calculate iv information</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>result_counts</strong> (<em>DTable.</em>) – <dl class="docutils">
<dt>It is like:</dt>
<dd><dl class="first docutils">
<dt>{‘x1’: [[event_count, non_event_count], [event_count, non_event_count] … ],</dt>
<dd>’x2’: [[event_count, non_event_count], [event_count, non_event_count] … ],
…</dd>
</dl>
<p class="last">}</p>
</dd>
</dl>
</li>
<li><strong>adjustment_factor</strong> (<em>float</em>) – The adjustment factor when calculating WOE</li>
<li><strong>split_points</strong> (<em>dict</em>) – <dl class="docutils">
<dt>split_points = {‘x1’: [0.1, 0.2, 0.3, 0.4 …],    # The first feature</dt>
<dd>’x2’: [1, 2, 3, 4, …],           # The second feature
…]                         # Other features</dd>
</dl>
</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><dl class="docutils">
<dt>{‘x1’: attr_obj,</dt>
<dd><p class="first last">’x2’: attr_obj
…
}</p>
</dd>
</dl>
</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Dict of IVAttributes object</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.base_binning.Binning.cal_local_iv">
<code class="descname">cal_local_iv</code><span class="sig-paren">(</span><em>data_instances</em>, <em>split_points=None</em>, <em>label_table=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.cal_local_iv"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.cal_local_iv" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate iv attributes</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>data_instances</strong> (<em>DTable</em>) – The input data</li>
<li><strong>split_points</strong> (<em>dict.</em>) – <p>Each value represent for the split points for a feature. The element in each row represent for
the corresponding split point.
e.g.
split_points = {‘x1’: [0.1, 0.2, 0.3, 0.4 …],    # The first feature</p>
<blockquote>
<div>’x2’: [1, 2, 3, 4, …],           # The second feature
…]                         # Other features</div></blockquote>
</li>
<li><strong>label_table</strong> (<em>DTable</em>) – id with labels</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Dict of IVAttributes object</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.base_binning.Binning.convert_feature_to_bin">
<code class="descname">convert_feature_to_bin</code><span class="sig-paren">(</span><em>data_instances</em>, <em>transform_cols_idx=-1</em>, <em>split_points=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.convert_feature_to_bin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.convert_feature_to_bin" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.base_binning.Binning.fit_split_points">
<code class="descname">fit_split_points</code><span class="sig-paren">(</span><em>data_instances</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.fit_split_points"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.fit_split_points" title="Permalink to this definition">¶</a></dt>
<dd><p>Get split points</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data_instances</strong> (<em>DTable</em>) – The input data</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>split_points</strong> – Each value represent for the split points for a feature. The element in each row represent for
the corresponding split point.
e.g.
split_points = {‘x1’: [0.1, 0.2, 0.3, 0.4 …],    # The first feature<blockquote>
<div>’x2’: [1, 2, 3, 4, …],           # The second feature
…]                         # Other features</div></blockquote>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">dict.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="staticmethod">
<dt id="federatedml.feature.binning.base_binning.Binning.get_bin_num">
<em class="property">static </em><code class="descname">get_bin_num</code><span class="sig-paren">(</span><em>value</em>, <em>split_points</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.get_bin_num"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.get_bin_num" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.base_binning.Binning.get_data_bin">
<code class="descname">get_data_bin</code><span class="sig-paren">(</span><em>data_instances</em>, <em>split_points=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.get_data_bin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.get_data_bin" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply the binning method</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>data_instances</strong> (<em>DTable</em>) – The input data</li>
<li><strong>split_points</strong> (<em>dict.</em>) – <p>Each value represent for the split points for a feature. The element in each row represent for
the corresponding split point.
e.g.
split_points = {‘x1’: [0.1, 0.2, 0.3, 0.4 …],    # The first feature</p>
<blockquote>
<div>’x2’: [1, 2, 3, 4, …],           # The second feature
…]                         # Other features</div></blockquote>
</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><p><strong>data_bin_table</strong> – Each element represent for the corresponding bin number this feature belongs to.
e.g. it could be:
[{‘x1’: 1, ‘x2’: 5, ‘x3’: 2}
…</p>
<blockquote>
<div><p>]</p>
</div></blockquote>
</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">DTable.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.base_binning.Binning.get_sparse_bin">
<code class="descname">get_sparse_bin</code><span class="sig-paren">(</span><em>transform_cols_idx</em>, <em>split_points_dict</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.get_sparse_bin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.get_sparse_bin" title="Permalink to this definition">¶</a></dt>
<dd><p>Get which bins the 0 located at for each column.</p>
</dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.base_binning.Binning.reconstruct_by_iv_obj">
<code class="descname">reconstruct_by_iv_obj</code><span class="sig-paren">(</span><em>col_name</em>, <em>iv_attr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.reconstruct_by_iv_obj"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.reconstruct_by_iv_obj" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.base_binning.Binning.transform">
<code class="descname">transform</code><span class="sig-paren">(</span><em>data_instances</em>, <em>transform_cols_idx</em>, <em>transform_type</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.transform"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.transform" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="staticmethod">
<dt id="federatedml.feature.binning.base_binning.Binning.woe_1d">
<em class="property">static </em><code class="descname">woe_1d</code><span class="sig-paren">(</span><em>data_event_count</em>, <em>adjustment_factor</em>, <em>split_points</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#Binning.woe_1d"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.Binning.woe_1d" title="Permalink to this definition">¶</a></dt>
<dd><p>Given event and non-event count in one column, calculate its woe value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>data_event_count</strong> (<em>list</em>) – [(event_sum, non-event_sum), (same sum in second_bin), (in third bin) …]</li>
<li><strong>adjustment_factor</strong> (<em>float</em>) – The adjustment factor when calculating WOE</li>
<li><strong>split_points</strong> (<em>list</em>) – For this specific column, its split_points for each bin.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>IVAttributes</strong> – Stored information that related iv and woe value</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="federatedml.feature.binning.base_binning.IVAttributes">
<em class="property">class </em><code class="descclassname">federatedml.feature.binning.base_binning.</code><code class="descname">IVAttributes</code><span class="sig-paren">(</span><em>woe_array</em>, <em>iv_array</em>, <em>event_count_array</em>, <em>non_event_count_array</em>, <em>event_rate_array</em>, <em>non_event_rate_array</em>, <em>split_points=None</em>, <em>iv=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#IVAttributes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.IVAttributes" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<dl class="attribute">
<dt id="federatedml.feature.binning.base_binning.IVAttributes.bin_nums">
<code class="descname">bin_nums</code><a class="headerlink" href="#federatedml.feature.binning.base_binning.IVAttributes.bin_nums" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="federatedml.feature.binning.base_binning.IVAttributes.is_woe_monotonic">
<code class="descname">is_woe_monotonic</code><a class="headerlink" href="#federatedml.feature.binning.base_binning.IVAttributes.is_woe_monotonic" title="Permalink to this definition">¶</a></dt>
<dd><p>Check the woe is monotonic or not</p>
</dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.base_binning.IVAttributes.reconstruct">
<code class="descname">reconstruct</code><span class="sig-paren">(</span><em>iv_obj</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#IVAttributes.reconstruct"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.IVAttributes.reconstruct" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.base_binning.IVAttributes.result_dict">
<code class="descname">result_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#IVAttributes.result_dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.IVAttributes.result_dict" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="federatedml.feature.binning.base_binning.SparseBinningResult">
<em class="property">class </em><code class="descclassname">federatedml.feature.binning.base_binning.</code><code class="descname">SparseBinningResult</code><span class="sig-paren">(</span><em>split_points</em>, <em>sparse_bin_num</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/base_binning.html#SparseBinningResult"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.base_binning.SparseBinningResult" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
</dd></dl>

</div>
<div class="section" id="module-federatedml.feature.binning.bucket_binning">
<span id="federatedml-feature-binning-bucket-binning-module"></span><h2>federatedml.feature.binning.bucket_binning module<a class="headerlink" href="#module-federatedml.feature.binning.bucket_binning" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="federatedml.feature.binning.bucket_binning.BucketBinning">
<em class="property">class </em><code class="descclassname">federatedml.feature.binning.bucket_binning.</code><code class="descname">BucketBinning</code><span class="sig-paren">(</span><em>params</em>, <em>party_name='Base'</em>, <em>abnormal_list=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/bucket_binning.html#BucketBinning"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.bucket_binning.BucketBinning" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#federatedml.feature.binning.base_binning.Binning" title="federatedml.feature.binning.base_binning.Binning"><code class="xref py py-class docutils literal notranslate"><span class="pre">federatedml.feature.binning.base_binning.Binning</span></code></a></p>
<p>For bucket binning, the length of each bin is the same which is:
L = [max(x) - min(x)] / n</p>
<p>The split points are min(x) + L * k
where k is the index of a bin.</p>
<dl class="method">
<dt id="federatedml.feature.binning.bucket_binning.BucketBinning.fit_split_points">
<code class="descname">fit_split_points</code><span class="sig-paren">(</span><em>data_instances</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/bucket_binning.html#BucketBinning.fit_split_points"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.bucket_binning.BucketBinning.fit_split_points" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply the binning method</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data_instances</strong> (<em>DTable</em>) – The input data</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>split_points</strong> – Each value represent for the split points for a feature. The element in each row represent for
the corresponding split point.
e.g.
split_points = {‘x1’: [0.1, 0.2, 0.3, 0.4 …],    # The first feature<blockquote>
<div>’x2’: [1, 2, 3, 4, …],           # The second feature
…]                         # Other features</div></blockquote>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">dict.</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-federatedml.feature.binning.quantile_binning">
<span id="federatedml-feature-binning-quantile-binning-module"></span><h2>federatedml.feature.binning.quantile_binning module<a class="headerlink" href="#module-federatedml.feature.binning.quantile_binning" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="federatedml.feature.binning.quantile_binning.QuantileBinning">
<em class="property">class </em><code class="descclassname">federatedml.feature.binning.quantile_binning.</code><code class="descname">QuantileBinning</code><span class="sig-paren">(</span><em>params</em>, <em>party_name='Base'</em>, <em>abnormal_list=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/quantile_binning.html#QuantileBinning"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.quantile_binning.QuantileBinning" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#federatedml.feature.binning.base_binning.Binning" title="federatedml.feature.binning.base_binning.Binning"><code class="xref py py-class docutils literal notranslate"><span class="pre">federatedml.feature.binning.base_binning.Binning</span></code></a></p>
<p>After quantile binning, the numbers of elements in each binning are equal.</p>
<p>The result of this algorithm has the following deterministic bound:
If the data_instances has N elements and if we request the quantile at probability <cite>p</cite> up to error
<cite>err</cite>, then the algorithm will return a sample <cite>x</cite> from the data so that the <em>exact</em> rank
of <cite>x</cite> is close to (p * N).
More precisely,</p>
<dl class="docutils">
<dt>{{{</dt>
<dd>floor((p - 2 * err) * N) &lt;= rank(x) &lt;= ceil((p + 2 * err) * N)</dd>
</dl>
<p>}}}</p>
<p>This method implements a variation of the Greenwald-Khanna algorithm (with some speed
optimizations).</p>
<dl class="staticmethod">
<dt id="federatedml.feature.binning.quantile_binning.QuantileBinning.approxiQuantile">
<em class="property">static </em><code class="descname">approxiQuantile</code><span class="sig-paren">(</span><em>data_instances</em>, <em>params</em>, <em>cols_dict</em>, <em>abnormal_list</em>, <em>header</em>, <em>is_sparse</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/quantile_binning.html#QuantileBinning.approxiQuantile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.quantile_binning.QuantileBinning.approxiQuantile" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculates each quantile information</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>data_instances</strong> (<em>DTable</em>) – The input data</li>
<li><strong>cols_dict</strong> (<em>dict</em>) – Record key, value pairs where key is cols’ name, and value is cols’ index.</li>
<li><strong>params</strong> (<em>FeatureBinningParam object</em><em>,</em>) – Parameters that user set.</li>
<li><strong>abnormal_list</strong> (<em>list</em><em>, </em><em>default: None</em>) – Specify which columns are abnormal so that will not static when traveling.</li>
<li><strong>header</strong> (<em>list</em><em>,</em>) – Storing the header information.</li>
<li><strong>is_sparse</strong> (<em>bool</em>) – Specify whether data_instance is in sparse type</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><p><strong>summary_dict</strong> –</p>
<dl class="docutils">
<dt>{‘col_name1’: summary1,</dt>
<dd><p class="first last">’col_name2’: summary2,
…
}</p>
</dd>
</dl>
</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">dict</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.quantile_binning.QuantileBinning.fit_split_points">
<code class="descname">fit_split_points</code><span class="sig-paren">(</span><em>data_instances</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/quantile_binning.html#QuantileBinning.fit_split_points"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.quantile_binning.QuantileBinning.fit_split_points" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply the binning method</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data_instances</strong> (<em>DTable</em>) – The input data</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>split_points</strong> – Each value represent for the split points for a feature. The element in each row represent for
the corresponding split point.
e.g.
split_points = {‘x1’: [0.1, 0.2, 0.3, 0.4 …],    # The first feature<blockquote>
<div>’x2’: [1, 2, 3, 4, …],           # The second feature
…]                         # Other features</div></blockquote>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">dict.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="staticmethod">
<dt id="federatedml.feature.binning.quantile_binning.QuantileBinning.insert_datas">
<em class="property">static </em><code class="descname">insert_datas</code><span class="sig-paren">(</span><em>data_instances</em>, <em>summary_dict</em>, <em>cols_dict</em>, <em>header</em>, <em>is_sparse</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/quantile_binning.html#QuantileBinning.insert_datas"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.quantile_binning.QuantileBinning.insert_datas" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="staticmethod">
<dt id="federatedml.feature.binning.quantile_binning.QuantileBinning.merge_summary_dict">
<em class="property">static </em><code class="descname">merge_summary_dict</code><span class="sig-paren">(</span><em>s_dict1</em>, <em>s_dict2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/quantile_binning.html#QuantileBinning.merge_summary_dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.quantile_binning.QuantileBinning.merge_summary_dict" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="federatedml.feature.binning.quantile_binning.QuantileBinning.query_quantile_point">
<code class="descname">query_quantile_point</code><span class="sig-paren">(</span><em>data_instances</em>, <em>cols</em>, <em>query_points</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/federatedml/feature/binning/quantile_binning.html#QuantileBinning.query_quantile_point"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#federatedml.feature.binning.quantile_binning.QuantileBinning.query_quantile_point" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-federatedml.feature.binning">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-federatedml.feature.binning" title="Permalink to this headline">¶</a></h2>
</div>
</div>


           </div>
           
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, FATE_TEAM

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>